Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow Registry: Add remaining tests for workflow registry manager #15359

Merged
merged 3 commits into from
Nov 25, 2024

Conversation

eutopian
Copy link
Contributor

  • Fill in the skeleton tests for WorkflowRegistryManager
  • Fix a bug with deleteWorkflow that deleted the name before sending the event
  • Add VersionAlreadyActive when trying to activate the current active version in WorkflowRegistryManager

@eutopian eutopian requested a review from a team as a code owner November 21, 2024 12:41
Copy link
Contributor

I see you updated files related to contracts. Please run pnpm changeset in the contracts directory to add a changeset.

Copy link
Contributor

github-actions bot commented Nov 21, 2024

Static analysis results are available

Hey @eutopian, you can view Slither reports in the job summary here or download them as artifact here.
Please check them before merging and make sure you have addressed all issues.

@eutopian eutopian force-pushed the add-more-workflow-registry-tests branch from 1df2084 to a14a469 Compare November 21, 2024 12:51
@eutopian eutopian requested review from a team as code owners November 21, 2024 12:51
@eutopian eutopian force-pushed the add-more-workflow-registry-tests branch 12 times, most recently from 9052490 to ab849b7 Compare November 21, 2024 15:17
Copy link
Contributor

github-actions bot commented Nov 21, 2024

AER Report: CI Core ran successfully ✅

aer_workflow , commit

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

@@ -83,8 +83,8 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion {
bytes32 indexed workflowID, address indexed workflowOwner, uint32 indexed donID, string workflowName
);
event WorkflowForceUpdateSecretsRequestedV1(address indexed owner, bytes32 secretsURLHash, string workflowName);
event RegistryLockedV1(address indexed lockedBy);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why removing these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The event is highly infrequent and the index won't help much with anything except additional gas cost

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this will always be the contract owner only, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, when I think about it again, maybe this event doesn't even have to emit this information. The owner will always be an MSIG contract, probably MCMS.

@eutopian eutopian force-pushed the add-more-workflow-registry-tests branch 5 times, most recently from c1de9aa to ef5d732 Compare November 21, 2024 23:54
@eutopian eutopian force-pushed the add-more-workflow-registry-tests branch 6 times, most recently from 802b0ab to a067c24 Compare November 22, 2024 01:59
@@ -2,7 +2,7 @@ WorkflowRegistry.getWorkflowMetadataListByOwner
├── when the owner has workflows
│ ├── when start is 0
│ │ └── it returns the correct metadata list
│ ├── when start is greater than 0 and limit exceeds total
│ ├── when start is greater than 0
│ │ └── it returns the correct metadata list
│ ├── when limit is less than total workflows
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about when the limit is set to zero? I assume when you say limit, you mean page size? Perhaps this test is also missing in other view functions that return paged data.

s_registryManager.addVersion(address(mockWfrContract), s_chainID, s_deployedAt, true);

// Get the latest version number again, which should be 1.
uint32 versionNumber = s_registryManager.getLatestVersionNumber();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: maybe there would be more differences between this test and test_WhenAutoActivateIsFalse if another active version already exists on the contract. That means this has to return 2, and for the other test, it has to return 1.

s_registryManager.getLatestVersionNumber();

// Deploy a MockWorkflowRegistryContract contract
MockWorkflowRegistryContract mockWfrContract = new MockWorkflowRegistryContract();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mockWrfContract ?

_deployMockRegistryAndAddVersion(true);
uint32 versionNumber =
s_registryManager.getVersionNumberByContractAddressAndChainID(address(s_mockWorkflowRegistryContract), s_chainID);
assertEq(versionNumber, 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if I want to register a new version for the same WR contract on the same chain? Does that mean that getVersionNumberByContractAddressAndChainID will return the new version number after I register it (maybe adding a test for that)? And will my previous version forever be lost or can I still see it on the contract, e.g. via getAllVersions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm but if the contract address is the same and the chain id is the same then it can just activate the old one? I guess we don't have validation on uniqueness I think of (chain id + contract address) but I feel like on the product level that makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will punt on making the changes to make it unique but right now since the key is unique there can only be one anyway so it will just override the version with the new one

@eutopian eutopian force-pushed the add-more-workflow-registry-tests branch from a067c24 to 176a001 Compare November 25, 2024 15:05
@eutopian eutopian added this pull request to the merge queue Nov 25, 2024
Merged via the queue into develop with commit 90eb9ae Nov 25, 2024
167 of 169 checks passed
@eutopian eutopian deleted the add-more-workflow-registry-tests branch November 25, 2024 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants